var rootPath = getRootPath();

$(document).ready(function(){
	
	var packageCode = getQueryParamValue("packageCode");
	
	//试驾预约
	$("#packageExhibition_testdriveAppoint").click(function(){
		var brandCode = $("#packageExhibition_brandCode").val();
		var seriesCode = $("#packageExhibition_seriesCode").val();
		var modelCode = $("#packageExhibition_modelCode").val();
		var packageCode = $("#packageExhibition_packageCode").val();
		window.location.href = rootPath +"/views/at.html?packageCode="+packageCode;
		
	});
	
	//咨询底价
	$("#packageExhibition_askingPrice").click(function(){
		var brandCode = $("#packageExhibition_brandCode").val();
		var seriesCode = $("#packageExhibition_seriesCode").val();
		var modelCode = $("#packageExhibition_modelCode").val();
		var packageCode = $("#packageExhibition_packageCode").val();
		window.location.href = rootPath +"/views/ap.html?packageCode="+packageCode;
	});

	
	
	$.ajax({
		method : 'get',
		url : rootPath+'/wechat/api/showroom/packages?packageCode='+packageCode,
		error:function(XMLHttpRequest, ajaxOptions, thrownError){
			alert("连接服务器错误!");
		},
		success : function(resultData){
			
			$("#seriesImage").attr("src",rootPath+'/images/'+resultData.brandName+'/外观/'+resultData.seriesName+'/'+resultData.seriesName+'.jpg');
			
	        $("#packageExhibition_brandCode").val(resultData.brandCode);
	        $("#packageExhibition_seriesCode").val(resultData.seriesCode);
	        $("#packageExhibition_modelCode").val(resultData.modelCode);
	        $("#packageExhibition_packageCode").val(resultData.packageCode);
	        
	        $("#packageExhibition_guidePrice").text(emptyValConvert(resultData.guidePrice));
	        $("#packageExhibition_localPrice").text(emptyValConvert(resultData.localPrice));
	        
			
			$("#packageNameSpan").html(resultData.packageName);
			
			var lengthWidthHeight=''
				
			if(resultData.length!=undefined && resultData.length!=''){
				lengthWidthHeight += resultData.length +'*';
			}
			if(resultData.width!=undefined && resultData.width!=''){
				lengthWidthHeight += resultData.width +'*';
			}
			
			if(resultData.height!=undefined && resultData.height!=''){
				lengthWidthHeight += resultData.height;
			}
			$("#lengthWidthHeight").text(lengthWidthHeight);
			
			$("#vehicleModel").text(packageValReplace(resultData.vehicleModel));
			$("#standardGear").text(packageValReplace(resultData.standardGear));
			$("#engine").text(packageValReplace(resultData.engine));
			$("#gearbox").text(packageValReplace(resultData.gearbox));
			$("#bodyStructure").text(packageValReplace(resultData.bodyStructure));
			$("#miitFuelConsum").text(packageValReplace(resultData.miitFuelConsum));
			$("#length").text(packageValReplace(resultData.length));
			$("#width").text(packageValReplace(resultData.width));
			$("#height").text(packageValReplace(resultData.height));
			$("#wheelBase").text(packageValReplace(resultData.wheelBase));
			$("#fwTrack").text(packageValReplace(resultData.fwTrack));
			$("#rwTrack").text(packageValReplace(resultData.rwTrack));
			$("#curbWeight").text(packageValReplace(resultData.curbWeight));
			$("#cargoVolume").text(packageValReplace(resultData.cargoVolume));
			$("#engineModel").text(packageValReplace(resultData.engineModel));
			$("#displacement").text(packageValReplace(resultData.displacement))
			$("#cylinderVolume").text(packageValReplace(resultData.cylinderVolume));
			$("#airIntakeForm").text(packageValReplace(resultData.airIntakeForm));
			$("#cylinderArran").text(packageValReplace(resultData.cylinderArran));
			$("#cylinderNum").text(packageValReplace(resultData.cylinderNum));
			$("#cylinderNumPer").text(packageValReplace(resultData.cylinderNumPer));
			$("#reductionRatio").text(packageValReplace(resultData.reductionRatio));
			$("#maxHorsepower").text(packageValReplace(resultData.maxHorsepower));
			$("#maxPower").text(packageValReplace(resultData.maxPower));
			$("#maxPowerSpeed").text(packageValReplace(resultData.maxPowerSpeed));
			$("#maxTorque").text(packageValReplace(resultData.maxTorque));
			$("#maxTorqueSpeed").text(packageValReplace(resultData.maxTorqueSpeed));
			$("#fuelType").text(packageValReplace(resultData.fuelType));
			$("#fuelLabel").text(packageValReplace(resultData.fuelLabel));
			$("#oilSupplyWay").text(packageValReplace(resultData.oilSupplyWay));
			$("#fueltankVolume").text(packageValReplace(resultData.fueltankVolume));
			$("#gearNum").text(packageValReplace(resultData.gearNum));
			$("#gearboxType").text(packageValReplace(resultData.gearboxType));
			$("#driveWay").text(packageValReplace(resultData.driveWay));
			$("#frontSusType").text(packageValReplace(resultData.frontSusType));
			$("#rearSusType").text(packageValReplace(resultData.rearSusType));
			$("#powerType").text(packageValReplace(resultData.powerType));
			$("#faType").text(packageValReplace(resultData.faType));
			$("#raType").text(packageValReplace(resultData.raType));
			$("#ftSize").text(packageValReplace(resultData.ftSize));
			$("#rtSize").text(packageValReplace(resultData.rtSize));
			$("#spareTireSize").text(packageValReplace(resultData.spareTireSize));
			$("#wheelHubMaterial").text(packageValReplace(resultData.wheelHubMaterial));
			$("#drivingAirbag").text(packageValReplace(resultData.drivingAirbag));
			$("#copilotAirbag").text(packageValReplace(resultData.copilotAirbag));
			$("#fsAirbag").text(packageValReplace(resultData.fsAirbag));
			$("#fhAirbag").text(packageValReplace(resultData.fhAirbag));
			$("#kneeAirbag").text(packageValReplace(resultData.kneeAirbag));
			$("#rsAirbag").text(packageValReplace(resultData.rsAirbag));
			$("#rhAirbag").text(packageValReplace(resultData.rhAirbag));
			$("#saBeltPrompt").text(packageValReplace(resultData.saBeltPrompt));
			$("#tirePmDevices").text(packageValReplace(resultData.tirePmDevices));
			$("#zeroPressureLc").text(packageValReplace(resultData.zeroPressureLc));
			$("#cenLock").text(packageValReplace(resultData.cenLock));
			$("#csLock").text(packageValReplace(resultData.csLock));
			$("#teleKey").text(packageValReplace(resultData.teleKey));
			$("#keylessSs").text(packageValReplace(resultData.keylessSs));
			$("#engineElecGuard").text(packageValReplace(resultData.engineElecGuard));
			$("#absAntiLock").text(packageValReplace(resultData.absAntiLock));
			$("#brakeForceDisb").text(packageValReplace(resultData.brakeForceDisb));
			$("#brakeAssist").text(packageValReplace(resultData.brakeAssist));
			$("#tractionControl").text(packageValReplace(resultData.tractionControl));
			$("#stabilityControl").text(packageValReplace(resultData.stabilityControl));
			$("#assistParking").text(packageValReplace(resultData.assistParking));
			$("#slopeSlowDescent").text(packageValReplace(resultData.slopeSlowDescent));
			$("#varSusp").text(packageValReplace(resultData.varSusp));
			$("#airSusp").text(packageValReplace(resultData.airSusp));
			$("#varSteerRatio").text(packageValReplace(resultData.varSteerRatio));
			$("#autoPi").text(packageValReplace(resultData.autoPi));
			$("#autoCruise").text(packageValReplace(resultData.autoCruise));
			$("#cruiseControl").text(packageValReplace(resultData.cruiseControl));
			$("#doublingAuxiliary").text(packageValReplace(resultData.doublingAuxiliary));
			$("#initiativeBrake").text(packageValReplace(resultData.initiativeBrake));
			$("#activeSteerSystem").text(packageValReplace(resultData.activeSteerSystem));
			$("#powerSunroof").text(packageValReplace(resultData.powerSunroof));
			$("#panoramicSunroof").text(packageValReplace(resultData.panoramicSunroof));
			$("#motionAppearSuite").text(packageValReplace(resultData.motionAppearSuite));
			$("#elecSuctionDoor").text(packageValReplace(resultData.elecSuctionDoor));
			$("#leatherSw").text(packageValReplace(resultData.leatherSw));
			$("#swAdjust").text(packageValReplace(resultData.swAdjust));
			$("#swElecAdjust").text(packageValReplace(resultData.swElecAdjust));
			$("#multiFunSw").text(packageValReplace(resultData.multiFunSw));
			$("#swShift").text(packageValReplace(resultData.swShift));
			$("#reverRadar").text(packageValReplace(resultData.reverRadar));
			$("#reverVideoImages").text(packageValReplace(resultData.reverVideoImages));
			$("#drivingScreen").text(packageValReplace(resultData.drivingScreen));
			$("#hudDigisplay").text(packageValReplace(resultData.hudDigisplay));
			$("#gps").text(packageValReplace(resultData.gps));
			$("#locInterServices").text(packageValReplace(resultData.locInterServices));
			$("#nvSystem").text(packageValReplace(resultData.nvSystem));
			$("#controlLcdDisplay").text(packageValReplace(resultData.controlLcdDisplay));
			$("#panoramicCamera").text(packageValReplace(resultData.panoramicCamera));
			$("#ccScreen").text(packageValReplace(resultData.ccScreen));
			$("#catTv").text(packageValReplace(resultData.catTv));
			$("#rearLcd").text(packageValReplace(resultData.rearLcd));
			$("#multimediaSystem").text(packageValReplace(resultData.multimediaSystem));
			$("#speakersNum").text(packageValReplace(resultData.speakersNum));
			$("#seatMateria").text(packageValReplace(resultData.seatMateria));
			$("#movementStyleSeats").text(packageValReplace(resultData.movementStyleSeats));
			$("#seatHeightAdjust").text(packageValReplace(resultData.seatHeightAdjust));
			$("#lsAdjust").text(packageValReplace(resultData.lsAdjust));
			$("#ssAdjust").text(packageValReplace(resultData.ssAdjust));
			$("#driversElecAdjust").text(packageValReplace(resultData.driversElecAdjust));
			$("#srAngleAdjust").text(packageValReplace(resultData.srAngleAdjust));
			$("#srSeatMove").text(packageValReplace(resultData.srSeatMove));
			$("#rsElecAdjust").text(packageValReplace(resultData.rsElecAdjust));
			$("#elecChairMemory").text(packageValReplace(resultData.elecChairMemory));
			$("#frSeatHeating").text(packageValReplace(resultData.frSeatHeating));
			$("#rsVentilation").text(packageValReplace(resultData.rsVentilation));
			$("#massageSeat").text(packageValReplace(resultData.massageSeat));
			$("#trSeats").text(packageValReplace(resultData.trSeats));
			$("#rsWayDown").text(packageValReplace(resultData.rsWayDown));
			$("#frCentralArmrest").text(packageValReplace(resultData.frCentralArmrest));
			$("#rearCupHolder").text(packageValReplace(resultData.rearCupHolder));
			$("#bcPhone").text(packageValReplace(resultData.bcPhone));
			$("#extAudioInterface").text(packageValReplace(resultData.extAudioInterface));
			$("#audioSupportMp3").text(packageValReplace(resultData.audioSupportMp3));
			$("#headlight").text(packageValReplace(resultData.headlight));
			$("#drLamps").text(packageValReplace(resultData.drLamps));
			$("#autoHeadlights").text(packageValReplace(resultData.autoHeadlights));
			$("#shLamp").text(packageValReplace(resultData.shLamp));
			$("#frontFogLamp").text(packageValReplace(resultData.frontFogLamp));
			$("#hhAdjust").text(packageValReplace(resultData.hhAdjust));
			$("#hcDevice").text(packageValReplace(resultData.hcDevice));
			$("#atmoCarLights").text(packageValReplace(resultData.atmoCarLights));
			$("#frElecWins").text(packageValReplace(resultData.frElecWins));
			$("#winClipHandFun").text(packageValReplace(resultData.winClipHandFun));
			$("#heatProtectGlass").text(packageValReplace(resultData.heatProtectGlass));
			$("#rmElecRegulation").text(packageValReplace(resultData.rmElecRegulation));
			$("#rmHeating").text(packageValReplace(resultData.rmHeating));
			$("#rmAntiGlare").text(packageValReplace(resultData.rmAntiGlare));
			$("#rmElecFolding").text(packageValReplace(resultData.rmElecFolding));
			$("#rmMemory").text(packageValReplace(resultData.rmMemory));
			$("#rearWs").text(packageValReplace(resultData.rearWs));
			$("#rearsideWs").text(packageValReplace(resultData.rearsideWs));
			$("#vcMirror").text(packageValReplace(resultData.vcMirror));
			$("#rearWiper").text(packageValReplace(resultData.rearWiper));
			$("#sensingWiper").text(packageValReplace(resultData.sensingWiper));
			$("#acControlMode").text(packageValReplace(resultData.acControlMode));
			$("#rearIndeAc").text(packageValReplace(resultData.rearIndeAc));
			$("#rearDiffuser").text(packageValReplace(resultData.rearDiffuser));
			$("#tpZoneControl").text(packageValReplace(resultData.tpZoneControl));
			$("#carAirCondi").text(packageValReplace(resultData.carAirCondi));
			$("#carRefrigerator").text(packageValReplace(resultData.carRefrigerator));			

		}
	});
	
	//点击PK
	$("#packageExhibitionPk").click(function(){
		$("#packageExhibitionPk").attr("href","packageExhibitionPk.html?packageCode="+packageCode);
	});



});